<!-- <script setup>
import { ref } from 'vue'
import CrudTable from './components/CrudTable.vue'

// 导入API
import { listUser, getUser, addUser, updateUser, delUser } from './api/user'
import { listEmployee, getEmployee, addEmployee, updateEmployee, delEmployee } from './api/employee'
import { listStore, getStore, addStore, updateStore, delStore } from './api/store'
import { listMedicine, getMedicine, addMedicine, updateMedicine, delMedicine } from './api/medicine'
import { listInventory, getInventory, addInventory, updateInventory, delInventory } from './api/inventory'
import { listOrder, getOrder, addOrder, updateOrder, delOrder } from './api/order'
import { listOrderdetail, getOrderdetail, addOrderdetail, updateOrderdetail, delOrderdetail } from './api/orderdetail'
import { listSalesreport, getSalesreport, addSalesreport, updateSalesreport, delSalesreport } from './api/salesreport'

// 当前激活的选项卡
const activeTab = ref('user')

// 表格列配置
const userColumns = [
  { prop: 'id', label: 'ID', width: '80' },
  { prop: 'username', label: '用户名' },
  { prop: 'gender', label: '性别', formatter: (row) => ['男', '女', '保密'][row.gender] },
  { prop: 'phoneNumber', label: '联系电话' },
  { prop: 'address', label: '默认收货地址' },
  { prop: 'status', label: '状态', formatter: (row) => ['正常', '冻结'][row.status] },
  { prop: 'createTime', label: '注册时间' }
]

const employeeColumns = [
  { prop: 'id', label: 'ID', width: '80' },
  { prop: 'name', label: '员工姓名' },
  { prop: 'phone', label: '联系电话' },
  { prop: 'storeId', label: '所在门店ID' },
  { prop: 'role', label: '角色', formatter: (row) => ['门店员工', '配送员', '管理员'][row.role] },
  { prop: 'status', label: '状态', formatter: (row) => ['在职', '离职'][row.status] },
  { prop: 'createTime', label: '创建时间' }
]

const storeColumns = [
  { prop: 'id', label: 'ID', width: '80' },
  { prop: 'name', label: '门店名称' },
  { prop: 'address', label: '门店地址' },
  { prop: 'phone', label: '联系电话' },
  { prop: 'manager', label: '负责人姓名' },
  { prop: 'status', label: '门店状态', formatter: (row) => ['营业中', '暂停营业'][row.status] },
  { prop: 'createTime', label: '创建时间' }
]

const medicineColumns = [
  { prop: 'id', label: 'ID', width: '80' },
  { prop: 'name', label: '药品名称' },
  { prop: 'type', label: '药品类型/分类' },
  { prop: 'ingredients', label: '成分说明' },
  { prop: 'usageInfo', label: '用法用量' },
  { prop: 'contraindication', label: '禁忌' },
  { prop: 'price', label: '售价(元)'},
  { prop: 'status', label: '状态', formatter: (row) => ['在售', '停售'][row.status] }
]

const inventoryColumns = [
  { prop: 'id', label: 'ID', width: '80' },
  { prop: 'storeId', label: '门店ID' },
  { prop: 'medicineId', label: '药品ID' },
  { prop: 'quantity', label: '当前库存数量' },
  { prop: 'warningQty', label: '库存预警值' },
  { prop: 'updateTime', label: '库存更新时间' }
]

const orderColumns = [
  { prop: 'id', label: 'ID', width: '80' },
  { prop: 'userId', label: '下单用户ID' },
  { prop: 'storeId', label: '订单关联门店ID' },
  { prop: 'totalAmount', label: '订单总金额(元)', formatter: (row) => (row.totalAmount / 100).toFixed(2) },
  { prop: 'status', label: '订单状态', formatter: (row) => ['待付款', '已付款', '已发货', '已送达'][row.status] },
  { prop: 'payType', label: '支付方式', formatter: (row) => ['支付宝', '微信', '银行卡'][row.payType] },
  { prop: 'deliveryTime', label: '期望送达时间' },
  { prop: 'createTime', label: '下单时间' }
]

const orderdetailColumns = [
  { prop: 'id', label: 'ID', width: '80' },
  { prop: 'orderId', label: '所属订单ID' },
  { prop: 'medicineId', label: '药品ID' },
  { prop: 'quantity', label: '购买数量' },
  { prop: 'price', label: '药品单价(元)' }
]

const salesreportColumns = [
  { prop: 'id', label: 'ID', width: '80' },
  { prop: 'storeId', label: '门店ID' },
  { prop: 'reportDate', label: '报表生成日期' },
  { prop: 'totalSales', label: '总销售额(元)', formatter: (row) => (row.totalSales / 100).toFixed(2) },
  { prop: 'totalProfit', label: '总利润(元)', formatter: (row) => (row.totalProfit / 100).toFixed(2) },
  { prop: 'totalItems', label: '总销售数量' }
]
</script>

<template>
  <div class="app-container">
    <h1>药店管理系统</h1>
    
    <el-tabs v-model="activeTab" type="card">
      <el-tab-pane label="用户管理" name="user">
        <CrudTable
          :list-api="listUser"
          :get-api="getUser"
          :add-api="addUser"
          :update-api="updateUser"
          :del-api="delUser"
          :columns="userColumns"
          title="用户管理"
        />
      </el-tab-pane>
      
      <el-tab-pane label="员工管理" name="employee">
        <CrudTable
          :list-api="listEmployee"
          :get-api="getEmployee"
          :add-api="addEmployee"
          :update-api="updateEmployee"
          :del-api="delEmployee"
          :columns="employeeColumns"
          title="员工管理"
        />
      </el-tab-pane>
      
      <el-tab-pane label="门店管理" name="store">
        <CrudTable
          :list-api="listStore"
          :get-api="getStore"
          :add-api="addStore"
          :update-api="updateStore"
          :del-api="delStore"
          :columns="storeColumns"
          title="门店管理"
        />
      </el-tab-pane>
      
      <el-tab-pane label="药品管理" name="medicine">
        <CrudTable
          :list-api="listMedicine"
          :get-api="getMedicine"
          :add-api="addMedicine"
          :update-api="updateMedicine"
          :del-api="delMedicine"
          :columns="medicineColumns"
          title="药品管理"
        />
      </el-tab-pane>
      
      <el-tab-pane label="库存管理" name="inventory">
        <CrudTable
          :list-api="listInventory"
          :get-api="getInventory"
          :add-api="addInventory"
          :update-api="updateInventory"
          :del-api="delInventory"
          :columns="inventoryColumns"
          title="库存管理"
        />
      </el-tab-pane>
      
      <el-tab-pane label="订单管理" name="order">
        <CrudTable
          :list-api="listOrder"
          :get-api="getOrder"
          :add-api="addOrder"
          :update-api="updateOrder"
          :del-api="delOrder"
          :columns="orderColumns"
          title="订单管理"
        />
      </el-tab-pane>
      
      <el-tab-pane label="订单明细" name="orderdetail">
        <CrudTable
          :list-api="listOrderdetail"
          :get-api="getOrderdetail"
          :add-api="addOrderdetail"
          :update-api="updateOrderdetail"
          :del-api="delOrderdetail"
          :columns="orderdetailColumns"
          title="订单明细"
        />
      </el-tab-pane>
      
      <el-tab-pane label="销售报表" name="salesreport">
        <CrudTable
          :list-api="listSalesreport"
          :get-api="getSalesreport"
          :add-api="addSalesreport"
          :update-api="updateSalesreport"
          :del-api="delSalesreport"
          :columns="salesreportColumns"
          title="销售报表"
        />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<style scoped>
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #409EFF;
}
</style> -->

<script>

</script>

<template>

 <router-view/>
 
</template>

<style>

</style>
